<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>万科.海上映象 - 交房费用计算器</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
            background-color: #f8f9fa;
            color: #333;
            line-height: 1.6;
            padding: 20px;
        }
        
        .container {
            max-width: 800px;
            margin: 0 auto;
            background-color: white;
            border-radius: 12px;
            box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
            padding: 30px;
        }
        
        h1 {
            text-align: center;
            color: #2c3e50;
            margin-bottom: 30px;
            font-size: 28px;
            font-weight: 600;
        }
        
        .calculator {
            width: 100%;
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid #eaeaea;
        }
        
        .row {
            display: flex;
            align-items: center;
            padding: 15px;
            border-bottom: 1px solid #f0f0f0;
            transition: background-color 0.2s;
        }
        
        .row:hover {
            background-color: #f9f9f9;
        }
        
        .row:last-child {
            border-bottom: none;
        }
        
        .row-title {
            width: 180px;
            font-weight: 600;
            color: #555;
        }
        
        .input-group {
            display: flex;
            align-items: center;
            flex: 1;
        }
        
        .input-group input {
            padding: 10px 15px;
            border: 1px solid #ddd;
            border-radius: 6px;
            margin-right: 15px;
            font-size: 16px;
            flex: 1;
        }
        
        .input-group input:focus {
            outline: none;
            border-color: #4a90e2;
            box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
        }
        
        .result {
            font-weight: 600;
            color: #2c3e50;
            font-size: 16px;
        }
        
        .total-row {
            background-color: #f8f9fa;
            border-top: 2px solid #eaeaea;
            padding: 20px 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .total-row .row-title {
            font-size: 18px;
            color: #2c3e50;
        }
        
        .total-row .result {
            font-size: 20px;
            color: #e74c3c;
            font-weight: 600;
        }
        
        .note {
            margin-top: 30px;
            padding: 15px;
            background-color: #fffde7;
            border-radius: 8px;
            border-left: 4px solid #ffd663;
            font-size: 14px;
            color: #887744;
        }
        
        .note p {
            margin: 0;
        }
        
        @media (max-width: 600px) {
            .container {
                padding: 20px;
            }
            
            .row-title {
                width: 120px;
                font-size: 15px;
            }
            
            .result {
                font-size: 15px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>万科.海上映象 - 交房费用计算器</h1>
        
        <div class="calculator">
            <div class="row">
                <div class="row-title">购房单价：</div>
                <div class="input-group">
                    <input type="number" id="purchasePrice" placeholder="输入购房单价">
                    <span>元/平</span>
                </div>
            </div>
            
            <div class="row">
                <div class="row-title">户型面积：</div>
                <div class="input-group">
                    <input type="number" id="apartmentSize" placeholder="输入户型面积">
                    <span>平</span>
                </div>
            </div>
            
            <div class="row">
                <div class="row-title">实测面积-预测面积：</div>
                <div class="input-group">
                    <input type="number" step="0.01" id="areaDiff" placeholder="输入面积差额">
                    <span>平</span>
                </div>
            </div>
            
            <div class="row">
                <div class="row-title">物业费(三个月)：</div>
                <div class="result" id="propertyFee">¥0.00</div>
            </div>
            
            <div class="row">
                <div class="row-title">维修基金：</div>
                <div class="result" id="maintenanceFund">¥0.00</div>
            </div>
            
            <div class="row">
                <div class="row-title">实测面积差额费用：</div>
                <div class="result" id="areaFee">¥0.00</div>
            </div>
            
            <div class="total-row">
                <div class="row-title">总金额：</div>
                <div class="result" id="totalAmount">¥0.00</div>
            </div>
        </div>
        
        <div class="note">
            <p>目前已知：8/9/12/14四个150平的单元需要退0.15平，13单元不补不退，其他单元，一楼可能有点区别，2楼到顶楼的面积都是完全一致的</p>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const purchasePriceInput = document.getElementById('purchasePrice');
            const sizeInput = document.getElementById('apartmentSize');
            const areaDiffInput = document.getElementById('areaDiff');
            const propertyFeeOutput = document.getElementById('propertyFee');
            const maintenanceFundOutput = document.getElementById('maintenanceFund');
            const areaFeeOutput = document.getElementById('areaFee');
            const totalAmountOutput = document.getElementById('totalAmount');
            
            // 监听输入变化
            purchasePriceInput.addEventListener('input', updateCalculations);
            sizeInput.addEventListener('input', updateCalculations);
            areaDiffInput.addEventListener('input', updateCalculations);
            
            function updateCalculations() {
                const purchasePrice = parseFloat(purchasePriceInput.value) || 0;
                const baseArea = parseFloat(sizeInput.value) || 0;
                const areaDiff = parseFloat(areaDiffInput.value) || 0;
                
                // 检查是否输入完整信息
                if (isNaN(purchasePrice) || isNaN(baseArea)) {
                    propertyFeeOutput.textContent = '¥0.00';
                    maintenanceFundOutput.textContent = '¥0.00';
                    areaFeeOutput.textContent = '¥0.00';
                    totalAmountOutput.textContent = '¥0.00';
                    return;
                }
                
                // 计算物业费
                const propertyFee = ((baseArea + areaDiff) * 4.95 * 3).toFixed(2);
                propertyFeeOutput.textContent = `¥${formatCurrency(propertyFee)}`;
                
                // 计算维修基金
                const maintenanceFund = ((baseArea + areaDiff) * 38.85).toFixed(2);
                maintenanceFundOutput.textContent = `¥${formatCurrency(maintenanceFund)}`;
                
                // 计算实测面积差额费用
                const areaFee = (purchasePrice * areaDiff).toFixed(2);
                areaFeeOutput.textContent = `¥${formatCurrency(areaFee)}`;
                
                // 计算总金额
                const total = (
                    parseFloat(propertyFee) + 
                    parseFloat(maintenanceFund) + 
                    parseFloat(areaFee)
                ).toFixed(2);
                
                totalAmountOutput.textContent = `¥${formatCurrency(total)}`;
            }
            
            function formatCurrency(num) {
                return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
            }
        });
    </script>
</body>
</html>